package com.peaker.advertisingpro.utils

import com.dlong.dl10netassistant.OnNetThreadListener
import com.dlong.dl10netassistant.TcpClientThread

/**
 *  @ 作者 CODE_LYF
 *  @ 时间   2021/4/8.
 *  代码人生
 */
object TcpUtils {
    var tcpClientThread: TcpClientThread? = null

    fun startTcp(ip: String, port: Int, onNetThreadListener: OnNetThreadListener): TcpClientThread {
        if (tcpClientThread == null) {
            tcpClientThread = TcpClientThread(ip, port, onNetThreadListener)
        }
        return tcpClientThread!!
    }

    fun getTcpClientThread(onNetThreadListener: OnNetThreadListener): TcpClientThread {
        if (tcpClientThread == null) {
            tcpClientThread = TcpClientThread(Common.ip, Common.msg_port.toInt(), onNetThreadListener)
        }
        return tcpClientThread!!

    }


}